UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IUhIz6xg8fVtkSncxsryDUkduP1VYMsgh9WvCMAzyLk='
WHERE
key_id = '401303ee064fccd9ffea24c0cac2d5a5bb64b36204243858c467bb02e5909a2b'
AND (
token = 'IUhIz6xg8fVtkSncxsryDUkduP1VYMsgh9WvCMAzyLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)