UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NYPdTZnIIHv8dCxL5TVTlULa0W8Ou5NDCsjyFOUbEt4='
WHERE
key_id = '8b0c39ae075d606f4f174affc966a17f7f659c4039273250e14e99b2ae8caa18'
AND (
token = 'NYPdTZnIIHv8dCxL5TVTlULa0W8Ou5NDCsjyFOUbEt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)