UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnMCreMWy1t2qeUjEiwuFTPUZvKX1m7F+Qh8FtSx9cU='
WHERE
key_id = '9414c7be57d0d480d311a1e42c5e23630e50f99e16c97043ce5818d722cf6700'
AND (
token = 'xnMCreMWy1t2qeUjEiwuFTPUZvKX1m7F+Qh8FtSx9cU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)