UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fuR77mVOwLRmUVF4hZw1aeDlfk7HexlcgU6UzcB38N0='
WHERE
key_id = '348cb295a54e65cedae5093a0c9e6376e3de36ea4d762b77db012f950945d657'
AND (
token = 'fuR77mVOwLRmUVF4hZw1aeDlfk7HexlcgU6UzcB38N0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)