UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZzurS22IzSJYJBOYviuiELkN7kK5hOda6aZGGW+4i84='
WHERE
key_id = '16d4950d30c7c1aea2822d35b39b94402e4d2e2dfd5d909a21f729e8fbedc122'
AND (
token = 'ZzurS22IzSJYJBOYviuiELkN7kK5hOda6aZGGW+4i84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)