UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gRJF90rx0N8vNpAJihP41Sk2eruBpr+33orRLjvOzGY=' 
WHERE 
  key_id = '0b927355eed3b7fb0b616c89f14095f3b631e1d0ef95b51cfe237f3b495e541f' 
  AND (
    token = 'gRJF90rx0N8vNpAJihP41Sk2eruBpr+33orRLjvOzGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043