UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b6+Bsm4OxzLBotr9c8o2jux4m4UjGNc/oi0ILdqo390=' 
WHERE 
  key_id = '1eab5b4f2e4d7f9ecf9c692b331cbb0209904dc5ba5ea5a4e45a978cc0249c5b' 
  AND (
    token = 'b6+Bsm4OxzLBotr9c8o2jux4m4UjGNc/oi0ILdqo390=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028