UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oLK11V1pm2+IoZ+/JuMtSoQbSfL6sENw7M7iBrmHjnU='
WHERE
key_id = 'a47437b8c3f6addd618a9bed551a3b33e5a2183c9658b20cacbc7e2ee9494615'
AND (
token = 'oLK11V1pm2+IoZ+/JuMtSoQbSfL6sENw7M7iBrmHjnU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)