UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aN0Nf5wO9fnZtPnkWdO2BbLXtQatHunjgmE18ogMtLQ='
WHERE
key_id = 'a1d413653763a348fb7c05d63bffc9a58147f1e4390e5abf7a8c9c0bb4c6b24e'
AND (
token = 'aN0Nf5wO9fnZtPnkWdO2BbLXtQatHunjgmE18ogMtLQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)