UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FaOmJf5wCY/iaVxlGUQQqNkFbkU0hGY9ORp1nkLyV2k=' 
WHERE 
  key_id = '59c79ff189be94258b307e41f3471864f58e1e492b081331e220648601bca36a' 
  AND (
    token = 'FaOmJf5wCY/iaVxlGUQQqNkFbkU0hGY9ORp1nkLyV2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034