UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qye+wonaSH8ppzmp2Fa8DHDFbSGywC5mRtpy9PZwOxI=' 
WHERE 
  key_id = '1bb6d988e999acb7c305ca7abf9bd43fd6f43df34b328cc7924b6c33f69204b0' 
  AND (
    token = 'Qye+wonaSH8ppzmp2Fa8DHDFbSGywC5mRtpy9PZwOxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051