UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9B5FfZeoZpMNn0kfDVhtE/YEiIFumsMA7zSCh3XWvA='
WHERE
key_id = 'd33844ee39d8adbb1c37a00f3c6f97c77d1e306bf50a262b7269d789280ad6bf'
AND (
token = 'C9B5FfZeoZpMNn0kfDVhtE/YEiIFumsMA7zSCh3XWvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)