UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9rNXGAvJdN/ICj1OSJXjVOu6DVsI+Hd44OcarFE4Qn4='
WHERE
key_id = '48fe9bd5fe40d420602aaee4d2d6836380326536ee4ff0e744e39ffc6dabef02'
AND (
token = '9rNXGAvJdN/ICj1OSJXjVOu6DVsI+Hd44OcarFE4Qn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)