UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAT7hDXKCVIhhEchxw1NleIehfEzbmRsKtnX1DqzQhc='
WHERE
key_id = '748630fc9309ee5613c611ed27f7eb72ae298dd2c5b4a043cc79866ced250fe7'
AND (
token = 'aAT7hDXKCVIhhEchxw1NleIehfEzbmRsKtnX1DqzQhc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)