UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u1Lgmk46jDA90p2uFulrbVWQYALCr6P+WR8vVUtAMEE=' 
WHERE 
  key_id = '8bafe51c1bf975666144d07cac60b9d975b6ea1d683ed7575fa69f0ef40a32be' 
  AND (
    token = 'u1Lgmk46jDA90p2uFulrbVWQYALCr6P+WR8vVUtAMEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029