UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZy15ad8peUWKvyl1Dgf1IXJDaoLX/jCXpFffkeE9Wo=' 
WHERE 
  key_id = 'efca8f9a22c2a622c04a05d2323a5d2c41789cfe2745255ee13d8b544743210b' 
  AND (
    token = 'YZy15ad8peUWKvyl1Dgf1IXJDaoLX/jCXpFffkeE9Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025