UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A1y43Kik60k+rRJYcwd6ZuRAVKq2+/DTugsxZj99ggM='
WHERE
key_id = 'd951ce76c92e0d917e5bd0acd7d967c373c114b6aee2a0bb84e28e7dcfc25da5'
AND (
token = 'A1y43Kik60k+rRJYcwd6ZuRAVKq2+/DTugsxZj99ggM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)