UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RG/RcBU1l25g4kfroTVN7R4G34WywWLZ0DSCyqLCsfs=' 
WHERE 
  key_id = '7817adc11469c720f09dd03e41651f961bc5ab3b1e1b4986a9899d1542a8e98d' 
  AND (
    token = 'RG/RcBU1l25g4kfroTVN7R4G34WywWLZ0DSCyqLCsfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017