UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PC+nWh+jTk8xjE7QFEEbFXG/lL0MCK2MXX/Yug/kDSQ=' 
WHERE 
  key_id = 'd349c1c5015124e9a86ea1aab6875dcbb2328d037d5b7013fd3ea4a81d641299' 
  AND (
    token = 'PC+nWh+jTk8xjE7QFEEbFXG/lL0MCK2MXX/Yug/kDSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032