UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uPom6IwuA/zLR5Lb8IM1fW5CIU0Wjadxbdo7+XrYpDk=' 
WHERE 
  key_id = '5352bffa62db63f6c31d2b35b8be28cf8a9ccb7ef5b19e3187edb19c512d5b63' 
  AND (
    token = 'uPom6IwuA/zLR5Lb8IM1fW5CIU0Wjadxbdo7+XrYpDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033