UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IpCFUt9yNDg53ULYfsXe85uziv+SLpasEAWid1n9YG4='
WHERE
key_id = '6de25e84b83a4135152bf8cfeca4bcfefd77419f343d70236712ecb8a72fff57'
AND (
token = 'IpCFUt9yNDg53ULYfsXe85uziv+SLpasEAWid1n9YG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)