UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ICZjVSNOWGuds7LfLj+oqHWm0Nbcc2FyJhwUkbz7JvI=' 
WHERE 
  key_id = '2e6c3ab49a255a04218258f311c899baef838c0766cbf2907109191168add11c' 
  AND (
    token = 'ICZjVSNOWGuds7LfLj+oqHWm0Nbcc2FyJhwUkbz7JvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050