UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ugBhPOEJc4hq7R0vKWcH6BLWFoQQeLynPtPLqzyM84Q='
WHERE
key_id = '1279e29c43ea541f19bb3cb3b8893bb701cb8007347149e8d0f5be52d56ef58f'
AND (
token = 'ugBhPOEJc4hq7R0vKWcH6BLWFoQQeLynPtPLqzyM84Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)