UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aj+BGDhYAyxTdQ5rp/f0spg23eHopSEcWTx72zrJwpo='
WHERE
key_id = '2d4169f95d71eddc7626e1482a76c627d4b306acb2683a2397c2eda8344212f5'
AND (
token = 'aj+BGDhYAyxTdQ5rp/f0spg23eHopSEcWTx72zrJwpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)