UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+miPIwXwonArV1LtPnFemoZyxI8RwPJRhkHEHH/KVU=' 
WHERE 
  key_id = '2357513aa16f80a219ce73fab71669647e81ec591682faeec3cd5218a21709c3' 
  AND (
    token = 'e+miPIwXwonArV1LtPnFemoZyxI8RwPJRhkHEHH/KVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047