UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wBbuoiDgYPfGhbgl9nTDV2+QCCNTjPmAloYzLKHeyBs=' 
WHERE 
  key_id = 'fe279faf939c20026e18d661b11770235356b28886e80b52e6b17c02b202bc3d' 
  AND (
    token = 'wBbuoiDgYPfGhbgl9nTDV2+QCCNTjPmAloYzLKHeyBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024