UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WATuOXfk9C2Pcyc/A09gIGeznfpqrUyss+5HXk8YJzg='
WHERE
key_id = 'fff7fd8f3606a93118d3263c543e9af60b64cf73464ee457c3009412f7a847cd'
AND (
token = 'WATuOXfk9C2Pcyc/A09gIGeznfpqrUyss+5HXk8YJzg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)