UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yMmFGjimAPfWQ6YyYZ9ENrzgiLL0cKYoyklheE1miRM=' 
WHERE 
  key_id = '4176092e08e844946ccffa1634e08b3f157f1ec7b381b124717d979b1e56395a' 
  AND (
    token = 'yMmFGjimAPfWQ6YyYZ9ENrzgiLL0cKYoyklheE1miRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038