UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'huwK+F7Mq67Em41+ETHpg4O8MtkT5KAUci4M/DuLFb0=' 
WHERE 
  key_id = '31124a2e4bf374736008be435ff087c5ac44e5a6db23d4a28b4d65bf45b9b431' 
  AND (
    token = 'huwK+F7Mq67Em41+ETHpg4O8MtkT5KAUci4M/DuLFb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027