UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XA/eJShcjQX9Hjo1g1bk/g6+x4ljamr/6bJGzGvj9QY='
WHERE
key_id = 'f6d6642a1d9477fce7eb2507b95215c3974a14e7399a96fede8518e66b3255c5'
AND (
token = 'XA/eJShcjQX9Hjo1g1bk/g6+x4ljamr/6bJGzGvj9QY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)