UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x0rPunQJ3umt2dY9vhFipxlN0cvy1myQvDtDEK1lf0I='
WHERE
key_id = 'b7f33701f576d6371398a532c0c02fd4a524980cac5dd1a68043f656fe80a309'
AND (
token = 'x0rPunQJ3umt2dY9vhFipxlN0cvy1myQvDtDEK1lf0I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)