UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nTCRgMGgH+0I6KzQx0QPIBAl8iBIaNtGedqTYJppqLw='
WHERE
key_id = 'f10bbf7c02697225155a242ab26264d9abd751dd4bad35772887875ca51b4f3c'
AND (
token = 'nTCRgMGgH+0I6KzQx0QPIBAl8iBIaNtGedqTYJppqLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)