UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fD3s0n0uRFI3aq6+mkaaI8paSFgxX4h96IQoxu9/s9M=' 
WHERE 
  key_id = '131620d991d56abf752c637e4ff75364e6991b563c078d284eed053fa8a089af' 
  AND (
    token = 'fD3s0n0uRFI3aq6+mkaaI8paSFgxX4h96IQoxu9/s9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027