UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0uOsMS8IwGGbewFeBQ+kHgkrl8/IS01QSL/7/vzK3gU='
WHERE
key_id = 'c8a1ca8e083f7543825eebd62df7175a19d4164352e8d721e5a3ff7eeae9264d'
AND (
token = '0uOsMS8IwGGbewFeBQ+kHgkrl8/IS01QSL/7/vzK3gU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)