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