UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iKiJd7z+w+pQzFrOs4c/wF8PZ1fJNtqW8YVB9mtPuqM='
WHERE
key_id = 'e648aa35a04f179ccf3ab60c41ffba11617aa77c82bb36ea1952657cd55f407a'
AND (
token = 'iKiJd7z+w+pQzFrOs4c/wF8PZ1fJNtqW8YVB9mtPuqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)