UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JLqnIWWJSZ2ztCWG+IUz90ewEIHhClO95lKBzhw1LDg=' 
WHERE 
  key_id = 'deb235e8d34a56f34f86e4e74e2840766be062d209d03c6695ba6794903c0651' 
  AND (
    token = 'JLqnIWWJSZ2ztCWG+IUz90ewEIHhClO95lKBzhw1LDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034