UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cGpAPKC/Z7wwJWhnkJSIXkW6JjrBCxLZyZfLq1g/xK4='
WHERE
key_id = '328d548496cbd00278369968055bf1f55fb5b6e6bb00a8f1fe4ffa02c22b6874'
AND (
token = 'cGpAPKC/Z7wwJWhnkJSIXkW6JjrBCxLZyZfLq1g/xK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)