UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXPKW85aTiDXKygfl3u4KZplK7xlMUiuNSBENk1i2Uo='
WHERE
key_id = '2598c0bac260288bb34b8649927ed6e80c4df5b654364fa29f68019c0c13a821'
AND (
token = 'BXPKW85aTiDXKygfl3u4KZplK7xlMUiuNSBENk1i2Uo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)