UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IPqkOuOaIJ+kXOwGIq39oD1KpT1hQIxjrNMvxQHufFQ='
WHERE
key_id = 'f99b958a123b2fb2c934bc0e90b5bc9450b38e99b563ae3997dedcf9358fd9c2'
AND (
token = 'IPqkOuOaIJ+kXOwGIq39oD1KpT1hQIxjrNMvxQHufFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)