UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YANVQV8tmIFBpyipoTVpqqsCnx82GrXyP/LfSXQOhok=' 
WHERE 
  key_id = '07f83adcae34f8ebf18e479e1434a343b308f3783e3d2beaab1a409c9180d1e2' 
  AND (
    token = 'YANVQV8tmIFBpyipoTVpqqsCnx82GrXyP/LfSXQOhok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017