UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sR5sIMfzHceM7kIMyIuahWm07KXqRQ3dY/nrkSF7dls='
WHERE
key_id = '89dc636fd18b541069f1d03e6f466cf091e4d9903d685ea5780bb73c58e8ef78'
AND (
token = 'sR5sIMfzHceM7kIMyIuahWm07KXqRQ3dY/nrkSF7dls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)