UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y5MJ4sSam7S63z8h3uExEqLAXsetyswckB5ArNpN3wc='
WHERE
key_id = '1229dfaa80885502c75900c50055b8b4fb5e8997171cd37aca14d6d1366a587b'
AND (
token = 'y5MJ4sSam7S63z8h3uExEqLAXsetyswckB5ArNpN3wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)