UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UYwAHzqU2npfn4ooaZFsRa3alHmkYIh8nTuJIN/bInI=' 
WHERE 
  key_id = '45eba572084bbf12f816232920039dbea63f888a19317ea27172d04761ba4e68' 
  AND (
    token = 'UYwAHzqU2npfn4ooaZFsRa3alHmkYIh8nTuJIN/bInI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046