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