UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KExE0JF+PGyAaXx9/E4Rom1KO8VFYTD/CwTShWv5Gro='
WHERE
key_id = 'cef76016bf0777029fc7de70c0b7737800b3c93b61ba07dafdcdf8e3d1012a31'
AND (
token = 'KExE0JF+PGyAaXx9/E4Rom1KO8VFYTD/CwTShWv5Gro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)