UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mdkDLzHvyghHp68P+BxPvGzHOfg5Z4SXa4fl2pg1UZA='
WHERE
key_id = '20d334635121082e1cb6ccb97cf73d3303084391700c55a05657683175b2e537'
AND (
token = 'mdkDLzHvyghHp68P+BxPvGzHOfg5Z4SXa4fl2pg1UZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)