UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DuSHsMeJZdkiGbWXW8zdvWqJKS9cEl0CmjOlgwNI980=' 
WHERE 
  key_id = '7e9232721fddcd327b2371483a35b4b91c277a5c9a3c7efd27e0f8e2e104e1c8' 
  AND (
    token = 'DuSHsMeJZdkiGbWXW8zdvWqJKS9cEl0CmjOlgwNI980=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034