UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WraTZWXlLIQI5uBFOMd3wti73+WLfdc1jtTidEkHYqE=' 
WHERE 
  key_id = 'c3009b28b4d72c924c6382b186abe982cba71198da5c3b57c0116703e8f068a4' 
  AND (
    token = 'WraTZWXlLIQI5uBFOMd3wti73+WLfdc1jtTidEkHYqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033