UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8NOmjUiuoKF2pEtAyNzrHzxNjaLpV6IXydfQt8XgaP8='
WHERE
key_id = '6d81a2af362a917fa82b8cef3c0b7c8891b0641035e8f9a07d45d9b6e0e588f1'
AND (
token = '8NOmjUiuoKF2pEtAyNzrHzxNjaLpV6IXydfQt8XgaP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)