UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wATCqKAxjypx7DzZeY7zbiRMcNv8MEcnAgebzticKPc=' 
WHERE 
  key_id = '86642b59b3e88d53232a0832acbacb01637602913a63a3f2160433c5aa59d2fc' 
  AND (
    token = 'wATCqKAxjypx7DzZeY7zbiRMcNv8MEcnAgebzticKPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019