UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DTXG3MNikfVhobFZPFlbEnAZNNKS2R50+IUphW1hn2A=' 
WHERE 
  key_id = '0046acc325102a24f2563f50741ba029a640e4eea0354432c01b05d0fa36e27e' 
  AND (
    token = 'DTXG3MNikfVhobFZPFlbEnAZNNKS2R50+IUphW1hn2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050