UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lU6Oh8sLzUf/VdwCnIgDw3XKZZu98ofJ0btsr/3Nud8='
WHERE
key_id = 'b7b1cc58a61861b794bb29b825a5a44b0bb8cafb2d6d796d067f626e70b42a4d'
AND (
token = 'lU6Oh8sLzUf/VdwCnIgDw3XKZZu98ofJ0btsr/3Nud8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)