UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TcAl7h2KbrTS7RctJ+vglAsjys8iwZ51iRACt/yq6pU='
WHERE
key_id = 'c811f349f162220fbb3261aa0fafd92e771c10cd9f493473e25c64c5f5e41a7c'
AND (
token = 'TcAl7h2KbrTS7RctJ+vglAsjys8iwZ51iRACt/yq6pU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)