UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dldZA4VFdoKQycwZ5NqR7uyMiOC0KyBGW9TWEn6HYMo='
WHERE
key_id = '45b957fd35157a540cb8cc983590a9a28eb82bb92744aea1c1b58c72148591ec'
AND (
token = 'dldZA4VFdoKQycwZ5NqR7uyMiOC0KyBGW9TWEn6HYMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)