UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'del8CfxNb9zl1P68oizg0gWwbniBfBSb7eEUucAXEyM=' 
WHERE 
  key_id = '768439ebfe79c3e9fc601a5c50dcd1f2f79fbf5d2ca740deeb02fb6de776be67' 
  AND (
    token = 'del8CfxNb9zl1P68oizg0gWwbniBfBSb7eEUucAXEyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030