UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SqDLNWDtbpdAlIgF/XMgGkRq+eDjNO66MXRiRaY5I7w='
WHERE
key_id = '87f109320fda6699b597429a1427218b20a23eaff15c2d2ebe244f5883fd5bef'
AND (
token = 'SqDLNWDtbpdAlIgF/XMgGkRq+eDjNO66MXRiRaY5I7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)