UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ICJQRbzsYDpZOfZfkRw2rOEOunuks39//IwOfnX0AwE=' 
WHERE 
  key_id = '3fe14263d12d0d9babed220371f2874d5ef4322ecdab8f382b36dca9eeaa81c1' 
  AND (
    token = 'ICJQRbzsYDpZOfZfkRw2rOEOunuks39//IwOfnX0AwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041