UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ykc9/j27WNtitDiWcYW/WbNpU8Cppd5IGX/Uj9/VCvk='
WHERE
key_id = 'afbea926274bafd917e3638b942aa2966645fb1cd14dc062fb5222f94fc84603'
AND (
token = 'Ykc9/j27WNtitDiWcYW/WbNpU8Cppd5IGX/Uj9/VCvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)