UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WVxT05a3wsRYC1s+ZUqQx4cbRrLcOHTf0e+RufOXE2U=' 
WHERE 
  key_id = '0fe2ea102218c45c04b3da64f77f0c49616347b973c9ec6e6f545422170e8e3e' 
  AND (
    token = 'WVxT05a3wsRYC1s+ZUqQx4cbRrLcOHTf0e+RufOXE2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023